<?php

namespace app\home\controller;

use app\BaseController;
use think\Exception;

class ApiBase extends BaseController
{
    /**
     * @var mixed
     */
    protected $shopUser = [
        "user_id" => 0,
        "mer_id" => 0,
        "username" => '',
        "mobile" => '',
        "shop_id" => 0,
        "open_id" => '',
        'union_id' => '',
        'point' => 0
    ];

    /**
     * 商户ID
     * @var mixed
     */
    protected string $merId = '';
    protected $request_app = 9;

    /**
     * 初始化
     */
    protected function initialize(): void
    {
        try {
            $this->request_app = $this->request->request_app ?? 9;
            if (!empty($this->request->shopUser)) {
                $this->shopUser = $this->request->shopUser;
                $this->merId = $this->shopUser['mer_id'];
            }
        } catch (Exception $e) {
            api_result($e);
        }
    }
}
